home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Plug-In Power Pack for Netscape Communicator
/
Plug-In Power Pack for Netscape Communicator.iso
/
plugins
/
dataviews
/
dvtools
/
demos
/
surfdemo
/
surfutil.c
< prev
Wrap
C/C++ Source or Header
|
1997-05-08
|
4KB
|
150 lines
#ifndef lint
static char SccsId[]= "@(#)surfutil.c V1.10 3/17/95";
#endif
/*------------------------------------------------------------------
| file name -- surfutil.c
|
| Utilitiy functions.
|
| functions Description
| --------- -----------
| PrintMessage Changes and Draws the Message Text Objects
| SetMessage Changes the Message Text Objects
| DrawThreshRect Draws the special threshold box
| GetVdp Returns the vdp associated with the object.
|
|
|-----------------------------------------------------------------*/
#include "std.h"
#include "dvstd.h"
#include "dvtools.h"
#include "VOstd.h"
#include "Tfundecl.h"
#include "surfdata.h"
#include "dvinteract.h"
#include "VOfundecl.h"
#include "VUerfundecl.h"
#include "surffundecl.h"
/***************** Begin Function Declarations *************/
LOCAL ADDRESS return_vdp V_P_((OBJECT vd_obj, ADDRESS vdp, ADDRESS args));
/***************** End Function Declarations *************/
/*------------------------------------------------------------------
|
| PrintMessage
| Copies the string into the Message Buffer and updates the
| Message Object.
*/
void
PrintMessage (text, perm)
char *text;
BOOLPARAM perm;
{
CHAR oldstring[80];
/* Get and Set the string for the text object */
(VOID) S_STRCPY (oldstring, MessageBuf);
(VOID) S_STRCPY (MessageBuf, text);
/* Update the message object */
(VOID) TdpDrawNextObject (MainDrawport, MessageObj);
if (!perm)
{
/* Leave the message up so the user can read it, then
| display the old message. Msleep() is DataViews internal
| (host independent) function that sleeps for n miliseconds.
*/
Msleep (30);
/* Reset the message string and redraw the message object */
(VOID) S_STRCPY (MessageBuf, oldstring);
(VOID) TdpDrawNextObject (MainDrawport, MessageObj);
}
}
/*------------------------------------------------------------------
|
| SetMessage
| Copies the string into the Message Buffer.
*/
void
SetMessage (text)
char *text;
{
/* Just copy the test into the message buffer */
(VOID) S_STRCPY (MessageBuf, text);
}
/*------------------------------------------------------------------
|
| DrawThreshRect
| Draws the special threshold box. This routine calls VXcttrect.
|
| VXcttrect is an internal routine that graphically displays a
| threshold table using a rectangle; DV-Draw uses this when editing
| color threshold. The values define the portion of the table to draw.
|
| VOID VXcttrect(p1,value1,p2,value2,cttp,colcount,horiz_flag)
| DV_POINT *p1, *p2; (in screen coords)
| INT value1, value2; (Values associated with p1 and p2)
| (must be between 0-32387)
| COLOR_THRESHOLD *cttp; ( Pointer to color threshold table )
| INT colcount; ( Number of colors in the table. )
| DV_BOOL horiz_flag; ( YES draw the table horizontaly )
|
|
*/
void
DrawThreshRect (object)
OBJECT object;
{
RECTANGLE vp, dummy;
/* Get the screen coordinates of the object */
VOobBox (object, &vp, &dummy);
(VOID) TdpWorldToScreen (MainDrawport, &vp.ll, &vp.ll);
(VOID) TdpWorldToScreen (MainDrawport, &vp.ur, &vp.ur);
/* Draw the whold threshold table using this internal function */
VXcttrect (&vp.ll, 0, &vp.ur, 32767, ThreshTable, NUM_COLORS, NO);
}
/*------------------------------------------------------------------
|
| GetVdp
| Uses TobForEachVdp to returns object's vdp. This function assumes
| the object only has one vdp.
*/
ADDRESS
GetVdp (obj)
OBJECT obj;
{
/* Call return_vdp() for each vdp, this function assumes only one vdp */
return (VARDESC) TobForEachVdp (obj, return_vdp, (ADDRESS) NULL);
}
/*------------------------------------------------------------------
|
| return_vdp
|
| returns the passed vdp.
|
*/
/* ARGSUSED */
LOCAL ADDRESS
return_vdp (vd_obj, vdp, args)
OBJECT vd_obj;
ADDRESS vdp;
ADDRESS args;
{
return vdp;
}